package com.my.admin.service.impl;

import com.my.admin.entity.RoleMenu;
import com.my.admin.mapper.RoleMenuMapper;
import com.my.admin.service.RoleMenuService;
import com.my.admin.util.ServiceImplCache;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;

/**
 * @author my
 */
@Service
public class RoleMenuServiceImpl extends ServiceImplCache<RoleMenuMapper, RoleMenu> implements RoleMenuService {

    @Override
    @Caching(evict = { @CacheEvict(cacheNames = "batchInsert",allEntries = true) },
            put = { @CachePut(cacheNames = "roleMenu", key = "#menus") })
    public boolean batchInsert(long roleId, Long[] menus) {
        return baseMapper.batchInsert(roleId, menus) > 0;
    }

}
